<template>
	<view>
		<view class="top-img">
			<image v-if="code == 0" src="/static/shenhe1.png" style="width: 140rpx;height: 124rpx;" mode=""></image>
			<view v-if="code == 0" class="shen-txt1">
				审核中
			</view>

			<image v-if="code == 1" src="/static/shenhe2.png" style="width: 140rpx;height: 124rpx;" mode=""></image>
			<view v-if="code == 1" class="shen-txt2">
				入驻已通过
			</view>
			<view class="btn-gl" v-if="code == 1" @click="toguanli">
				管理店铺
			</view>
			<image v-if="code == 2" src="/static/shenhe3.png" style="width: 140rpx;height: 124rpx;" mode=""></image>
			<view v-if="code == 2" class="shen-txt3">
				入驻被驳回
			</view>
			<view class="yuanyin" v-if="code == 2">
				驳回原因:{{info.reject_reason}}
			</view>
		</view>

		<view class="shenhetime" v-if="code == 1">
			<view class="item-box">
				<view class="left-box">
					申请时间
				</view>
				<view class="right-time">
					{{$utils.timestampToTime(info.createtime)}}
				</view>
			</view>
			<view class="item-box">
				<view class="left-box">
					审批时间
				</view>
				<view class="right-time">
					{{$utils.timestampToTime(info.updatetime)}}
				</view>
			</view>
		</view>

		<view class="shenheinfo">
			<view class="infobox">
				<view class="title">
					申请信息
				</view>
				<view class="item-b">
					<view class="left-txt">
						店铺名称
					</view>
					<view class="right-txt">
						{{info.name}}
					</view>
				</view>
				<view class="item-b">
					<view class="left-txt">
						店铺类型
					</view>
					<view class="right-txt">
						<!-- 超市便利 -->
						{{fenleitxt}}
					</view>
				</view>

				<view class="item-b">
					<view class="left-txt">
						店铺简介
					</view>
					<view class="right-txt">
						{{info.introduction}}
					</view>
				</view>
				<view class="item-b">
					<view class="left-txt">
						店铺地址
					</view>
					<view class="right-txt">
						<!-- 男寝A栋对面小妹便利店 -->
						{{info.address}}
					</view>
				</view>
			</view>
			<!-- 门店logo -->
			<view class="logoinfo">
				<view class="title-yxy">
					门店LOGO及门店照
				</view>

				<view class="imgitem">
					<image v-for="(i,k) in environment_images" :key="k" :src="i"
						style="width: 124rpx;height: 124rpx;border-radius: 16rpx;" mode=""></image>
				</view>
			</view>
			<!-- 申请人 -->
			<view class="shenqigninfo">
				<view class="iteminfo">
					<view class="leftbox">
						申请人
					</view>
					<view class="txt-s">
						{{info.realname}}
					</view>
				</view>
				<view class="iteminfo">
					<view class="leftbox">
						联系电话
					</view>
					<view class="txt-s">
						{{info.mobile}}
					</view>
				</view>
				<view class="iteminfo">
					<view class="leftbox">
						店铺账号
					</view>
					<view class="txt-s">
						{{info.account}}
					</view>
				</view>
				<view class="iteminfo">
					<view class="leftbox">
						店铺密码
					</view>
					<view class="txt-s">
						{{info.password}}
					</view>
				</view>
			</view>
		</view>

		<view class="btnbox" v-if="code == 2">
			<view class="kefu" @click="call">
				联系客服
			</view>
			<view class="chongxin" @click="tosubmit">
				重新提交审核
			</view>
		</view>
	</view>
</template>

<script>
	var app = getApp( );
	import ikz from '@/pages/Common/tools.js';
	export default {
		data( ) {
			return {
				code: 2,
				imglist: [ {
						Image: '/static/shenhe2.png'
					},
					{
						Image: '/static/shenhe2.png'
					},
					{
						Image: '/static/shenhe2.png'
					},
					{
						Image: '/static/shenhe2.png'
					},
					{
						Image: '/static/shenhe2.png'
					},
				],
				info: '',
				environment_images: [ ],
				business_category_id: '',
				leixing: [ ],
				fenleitxt: '',
				customer_mobile: ''
			}
		},
		onLoad( ) {},
		onShow( ) {
			this.getinfo( )
			this.getfenlei( )
			this.getBaseinfo( )
		},
		methods: {
			toguanli(){
				uni.navigateTo({
					url:'/pages/Component/supermarket/Program/index/index'
				})
			},
			getfenlei( ) {
				var path = '/xyb/supermarket/Index/Index';
				var data = {
					token: uni.getStorageSync( 'local_user_session' ),
					agent_id: uni.getStorageSync( 'default_agent' ).id || ''
				}
				ikz.post( path, data, res => {
					console.log( res, 'ssssss' );
					if ( res.data.code ) {
						this.leixing = res.data.data.supermarket_category_list

					} else {
						uni.showModal( {
							title: '提示',
							content: res.data.msg,
							showCancel: false,
							success: function( res ) {}
						} );
					}
				} );
			},
			getinfo( ) {
				var path = '/merchant/info';
				var data = {
					token: uni.getStorageSync( 'local_user_session' ),
					agent_id: uni.getStorageSync( 'default_agent' ).id || ''
				}
				ikz.post( path, data, res => {
					console.log( res, 'ssssss' );
					if ( res.data.code == 1 ) {
						this.code = res.data.data.status
						console.log( this.code, 'code' );
						this.info = res.data.data
						this.business_category_id = res.data.data.business_category_id
						// 根据business_category_id匹配分类名称
						if ( this.leixing ) {
							const matchedCategory = this.leixing.find( item => item.id == this
								.business_category_id );
							if ( matchedCategory ) {
								this.fenleitxt = matchedCategory.name;
								console.log( this.fenleitxt, 'fenleitxt' );
							}
						}

						const environment_images = res.data.data.environment_images;
						const chars = environment_images.split( ',' );
						console.log( chars, 'chars' );
						this.environment_images = chars
					} else {
						uni.showModal( {
							title: '提示',
							content: res.data.msg,
							showCancel: false,
							success: function( res ) {}
						} );
					}
				} );
			},
			tosubmit( ) {
				uni.navigateTo( {
					url: '/pages/Component/Module/merchant/apply/index/index'
				} )
			},
			//获取用户信息
			getBaseinfo( ) {
				var path = '/xyb/user/baseinfo';
				var data = {
					token: uni.getStorageSync( 'local_user_session' ),
					app_plat: "MP-WEIXIN"
				};
				ikz.get( path, data, res => {
					if ( res.data.code ) {
						console.log( "值是", res.data.data );

						this.customer_mobile = res.data.data.customer_mobile
					}

				} );
			},

			call( ) {
				uni.makePhoneCall( {
					phoneNumber: this.customer_mobile //仅为示例
				} );

			}
		},
	}
</script>

<style lang="scss" scoped>
	.top-img {

		width: 100%;
		height: 260rpx;
		display: flex;
		flex-direction: column;
		align-items: center;

		.shen-txt1 {
			width: 100%;
			height: 44rpx;
			font-weight: 500;
			font-size: 30rpx;
			color: #666666;
			text-align: center;
		}

		.shen-txt3 {
			width: 100%;
			height: 44rpx;
			font-weight: 500;
			font-size: 30rpx;
			color: #EE4433;
			text-align: center;
		}

		.yuanyin {
			width: 100%;
			height: 38rpx;
			font-weight: 400;
			font-size: 26rpx;
			color: #666666;
			text-align: center;
			margin-top: 20rpx;
		}

		.shen-txt2 {
			width: 100%;
			height: 44rpx;
			font-weight: 500;
			font-size: 30rpx;
			color: #12C855;
			text-align: center;
		}

		.btn-gl {
			width: 278rpx;
			height: 72rpx;
			background: #247EFF;
			border-radius: 44rpx 44rpx 44rpx 44rpx;
			font-weight: 400;
			font-size: 26rpx;
			color: #FFFFFF;
			text-align: center;
			line-height: 72rpx;
			margin-top: 20rpx;
		}
	}

	.shenhetime {
		width: 690rpx;
		height: 144rpx;
		background: #F5F9FF;
		border-radius: 16rpx 16rpx 16rpx 16rpx;
		margin: 48rpx auto 24rpx;


		.item-box {
			width: 100%;
			height: 72rpx;
			background: #F5F9FF;
			display: flex;
			justify-content: space-between;
			align-items: center;
			padding: 0 16rpx;
			box-sizing: border-box;

			.left-box {
				width: 50%;
				height: 72rpx;
				line-height: 72rpx;
				font-weight: 400;
				font-size: 28rpx;
				color: #666666;
				text-align: left;
			}

			.right-time {
				width: 50%;
				height: 72rpx;
				line-height: 72rpx;
				font-weight: 400;
				font-size: 28rpx;
				color: #666666;
				text-align: right;
			}
		}
	}

	.shenheinfo {
		width: 690rpx;
		height: 1038rpx;
		background: #F5F9FF;
		border-radius: 16rpx 16rpx 16rpx 16rpx;
		margin: 24rpx auto;

		.infobox {
			width: 690rpx;
			height: 348rpx;
			border-bottom: 1rpx solid #EBEBEB;
			padding: 24rpx 16rpx;
			box-sizing: border-box;

			.title {
				font-weight: 500;
				font-size: 32rpx;
				color: #000000;
				text-align: left;
			}

			.item-b {
				width: 100%;
				height: 62rpx;
				display: flex;
				align-items: center;
				justify-content: space-between;
				margin-top: 2rpx;

				.left-txt {
					width: 50%;
					height: 40rpx;
					font-weight: 500;
					font-size: 28rpx;
					color: #666666;
					text-align: left;
				}

				.right-txt {
					width: 50%;
					height: 40rpx;
					font-weight: 400;
					font-size: 28rpx;
					color: #666666;
					text-align: right;
				}
			}
		}


		.logoinfo {
			width: 690rpx;
			height: 238rpx;
			padding: 30rpx 16rpx;
			box-sizing: border-box;
			border-bottom: 1rpx solid #EBEBEB;

			.title-yxy {
				width: 100%;
				height: 40rpx;
				font-weight: 500;
				font-size: 28rpx;
				color: #666666;
				text-align: left;
			}

			.imgitem {
				width: 100%;
				height: 124rpx;
				display: flex;
				align-items: center;
				justify-content: space-between;
				margin-top: 14rpx;
			}
		}

		.shenqigninfo {
			width: 690rpx;
			height: 448rpx;
			padding: 30rpx 16rpx;
			box-sizing: border-box;

			.iteminfo {
				width: 100%;
				height: 40rpx;
				display: flex;
				align-items: center;
				justify-content: space-between;
				margin-bottom: 22rpx;

				.leftbox {
					width: 50%;
					height: 40rpx;
					font-weight: 500;
					font-size: 28rpx;
					color: #666666;
					text-align: left;
				}

				.txt-s {
					width: 50%;
					height: 40rpx;
					font-weight: 400;
					font-size: 28rpx;
					color: #666666;
					text-align: right;
				}
			}
		}
	}


	.btnbox {
		width: 100%;
		height: 176rpx;
		display: flex;
		align-items: center;
		justify-content: space-between;
		// margin-top: 14rpx;
		padding: 14rpx 30rpx;
		box-sizing: border-box;

		.kefu {
			width: 314rpx;
			height: 88rpx;
			border-radius: 44rpx 44rpx 44rpx 44rpx;
			border: 2rpx solid #247EFF;
			font-weight: 400;
			font-size: 30rpx;
			color: #247EFF;
			text-align: center;
			line-height: 88rpx;
		}

		.chongxin {
			width: 314rpx;
			height: 88rpx;
			background: #247EFF;
			border-radius: 44rpx 44rpx 44rpx 44rpx;
			font-weight: 400;
			font-size: 30rpx;
			color: #FFFFFF;
			text-align: center;
			line-height: 88rpx;
		}
	}
</style>